package com.wclass.controller.app;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.google.common.collect.Lists;
import com.wclass.common.ReturnObject;
import com.wclass.entity.BaseHelpCenter;
import com.wclass.entity.BaseHelpType;
import com.wclass.interceptor.IgnoreAuth;
import com.wclass.service.IBaseHelpCenterService;
import com.wclass.service.IBaseHelpTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 帮助中心 前端控制器
 * </p>
 *
 * @author SEN
 * @since 2019-02-13
 */
@Api(description = "帮助中心管理")
@RestController
@RequestMapping("/helpCenter")
public class HelpCenterController {
    @Autowired
    private IBaseHelpCenterService helpCenterService;
    @Autowired
    private IBaseHelpTypeService helpTypeService;

    @IgnoreAuth
    @ApiOperation("获取帮助中心列表")
    @RequestMapping(value = "/getHelpTypeList", method = RequestMethod.POST)
    public ReturnObject<List<BaseHelpType>> getHelpTypeList(@ApiParam("类型\n" +
            "       1-平台导航\n" +
            "       2-学生帮助\n" +
            "       3-教师帮助\n" +
            "       4-管理条约\n" +
            "       101常见问题") @RequestParam Integer affiliation) {
        List<BaseHelpType> list = helpTypeService.selectListByAffiliation(affiliation);
        return new ReturnObject<>(0, "获取成功", list);
    }

    @IgnoreAuth
    @ApiOperation("获取帮助详情")
    @RequestMapping(value = "/getHelpCenterInfoById", method = RequestMethod.POST)
    public ReturnObject<BaseHelpCenter> getHelpCenterPage(@ApiParam("centerId") @RequestParam Integer centerId) {
        return new ReturnObject<>(0, "获取成功", helpCenterService.selectById(centerId));
    }
}

